package com.mall.inventory.server.controller;

import com.mall.inventory.common.Idempotent;

import java.lang.reflect.Method;


public class AnnotationProcessor {

    public static void main(String[] args) throws Exception {
        InventoryController paymentService = new InventoryController();
        Method method = paymentService.getClass().getMethod("processPayment", String.class);

        if (method.isAnnotationPresent(Idempotent.class)) {
            Idempotent idempotent = method.getAnnotation(Idempotent.class);
            System.out.println("Idempotent operation: " + idempotent.value());

            // 在这里可以添加幂等性处理的逻辑
            paymentService.processPayment("paymentId");
        }
    }
}
